/**
 * Created by zgx on 2016/11/23.
 */

$(function () {
    var path = window.location.pathname;
    var alist = document.getElementsByTagName("a");
    for (var i=0; i<alist.length;i++){
        if (getrueHref(alist[i]) && path != "/tea" && path != "/admin" && path != "/stu" ){
            var aNode = alist[i].parentNode.parentNode;

            if (aNode.className=="sub-menu"){
                aNode.style.overflow="hidden";
                aNode.style.display="block";
                alist[i].parentNode.className="active open";
                return ;
            }
            if(aNode.className=="main-navigation-menu" ){
                alist[i].parentNode.className="active open";
            }
        }
    }
})
function  getrueHref(href) {
    // var oldhref;
    if (href.toString().indexOf(window.location.pathname)>0){
        window.console.log(href);
        return true;
    }else{
        return false;
    }
}